package com.example.task1.ui.AllService.hospital;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.HospitalOrderBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class HospitalOrderAdapter extends BaseAdapter<HospitalOrderBean.RowsDTO> {

    private Context context;
    private List<HospitalOrderBean.RowsDTO> mData = new ArrayList<>();
    private TextView tvName;
    private TextView tvCategoryName;
    private TextView tvMoney;
    private TextView tvTime;

    @Override
    protected void setData(List<HospitalOrderBean.RowsDTO> rows) {
        int size = mData.size();
        mData.addAll(rows);
        notifyItemInserted(size);
    }

    @Override
    protected int getLayout() {
        return R.layout.hospitalorderlist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<HospitalOrderBean.RowsDTO> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, HospitalOrderBean.RowsDTO date) {
        tvName.setText("患者姓名:" + date.getPatientName());
        tvCategoryName.setText("科室类别名称:" + date.getCategoryName());
        tvMoney.setText("金额:" + date.getPatientName());
        tvTime.setText("预约时间：" + date.getReserveTime());
    }

    @Override
    protected void holder(View itemView) {
        initView(itemView);
    }

    private void initView(View view) {
        tvName = (TextView) view.findViewById(R.id.tv_name);
        tvCategoryName = (TextView) view.findViewById(R.id.tv_categoryName);
        tvMoney = (TextView) view.findViewById(R.id.tv_money);
        tvTime = (TextView) view.findViewById(R.id.tv_time);
    }
}
